import request from "@/utils/request";

export function loginApi(data) {
    return request({
        url:'/web/users/login',
        data:{
            ...data,
            referer:'pc'
        },
        method:"post"
    })
}

export function tagsApi(params) {
    return request({
        url:'/tags',
        params,
        method:"get"
    })
}

export function articlesList(params) {
    return request({
        url:'/web/articles/list',
        params,
        method:"get"
    })
}

export function FileList(params) {
    return request({
        url:'/web/file/list',
        params,
        method:"get"
    })
}

export function articlesAdd(data) {
    return request({
        url:'/web/articles',
        data,
        method:"post"
    })
}

export function articlesEdit(data) {
    return request({
        url:'/web/articles',
        data,
        method:"put"
    })
}

export function articlesDetail(id) {
    return request({
        url:`articles/${id}`,
        method:"get"
    })
}

export function tagsList(params) {
    return request({
        url:'/tags',
        params,
        method:"get"
    })
}

export function informationsList(params) {
    return request({
        url:'/informations',
        params,
        method:"get"
    })
}

export function informationsEdit(data) {
    return request({
        url:'/informations',
        data,
        method:"post"
    })
}

export function upload(data) {
    return request({
        url:'/upload',
        data,
        method:"post",
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

export function categorys(params) {
    return request({
        url:'/categorys',
        params,
        method:"get"
    })
}

export function filesDel(id) {
    return request({
        url:`/files/${id}`,
        method:"delete"
    })
}


export function addTag(data) {
    return request({
        url:`/tags`,
        method:"post",
        data
    })
}

export function delTag(data) {
    return request({
        url:`/tags`,
        method:"delete",
        data
    })
}

export function addCategorys(data) {
    return request({
        url:`/web/categorys`,
        method:"post",
        data
    })
}

export function delCategorys(data) {
    return request({
        url:`/web/categorys`,
        method:"delete",
        data
    })
}

export function categorysList(params) {
    return request({
        url:`/categorys`,
        method:"get",
        params
    })
}

export function userList(params) {
    return request({
        url:`/web/users/list`,
        method:"get",
        params
    })
}